﻿package mortal.game.scene3D.display3d.text3d.staticText3d.action
{
    import flash.geom.*;

    public class Action0MoveFun extends ActionMoveBase
    {
        private const _V:Number = 30;
        private const _A:Number = 4;
        private const _lastV:Number = 5;
        private const _moveTime:int = 3;
        private const _midTime:int = 10;
        private const _lastTime:int = 20;
        private const _waitTime:int = 15;
        private const _totalTime:int = 35;
        private const addScale:int = 5;
        private const subScale:int = 10;
        private const totalFrame:int = 15;
        private var _curOffY:int = 0;
        private var _curOffX:int = 0;
        private var _alpha:Number = 0.99;
        private var _scale:Number = 100;
        private var _cos:Number;
        private var _sin:Number;
        private var _hasRandomAngle:Boolean;

        public function Action0MoveFun()
        {
            return;
        }// end function

        override public function update(param1:int, param2:Vector3D) : Boolean
        {
            var _loc_3:int = 0;
            var _loc_4:Number = NaN;
            if (param1 > this._totalTime)
            {
                this._curOffY = 0;
                this._curOffX = 0;
                this._alpha = 0.99;
                this._scale = 100;
                this._hasRandomAngle = false;
                return false;
            }
            if (changeScale)
            {
                if (param1 <= this.addScale)
                {
                    this._scale = 100 + 150 * param1 / this.addScale;
                }
                else if (param1 <= this.totalFrame)
                {
                    this._scale = 250 - 150 * (param1 - this.addScale) / this.subScale;
                }
                else
                {
                    this._scale = 150;
                }
            }
            if (param1 <= this._moveTime)
            {
                this._curOffY = this._V * param1;
            }
            else if (param1 <= this._midTime)
            {
                _loc_3 = param1 - this._moveTime;
                this._curOffY = this._V * param1 - 0.5 * this._A * _loc_3 * _loc_3;
            }
            else if (param1 <= this._waitTime)
            {
            }
            else
            {
                if (!this._hasRandomAngle)
                {
                    this._hasRandomAngle = true;
                    _loc_4 = Math.random() * 90 - 45;
                    _loc_4 = _loc_4 / 180 * Math.PI + Math.PI / 2;
                    this._cos = Math.cos(_loc_4) * this._lastV;
                    this._sin = Math.sin(_loc_4) * this._lastV;
                }
                this._curOffX = this._curOffX + this._cos;
                this._curOffY = this._curOffY + this._sin;
                this._alpha = (this._totalTime - param1) / this._lastTime * 0.99;
            }
            param2.x = this._curOffX;
            param2.y = this._curOffY;
            param2.z = this._alpha + this._scale;
            return true;
        }// end function

    }
}
